#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h>
int main(int argc,const char*argv[])
{
    pid_t pid;
    if((pid = fork())<0)
    {
        perror("folk err");
        return -1;
    }
    else if(pid == 0)
    {
        printf("in child\n");
        exit(0);
    }
    else 
    {
        int status;
        wait(&status);
        printf("status:%d\n",status);
        //wait(NULL);//阻塞等待子进程退出，回收资源
        printf("in parent\n");
        while(1);
    }
    return 0;
}